package appapi.Vo;

import appapi.common.BaseEntity;
import appapi.common.UpdateGroup;
import appapi.entity.auth.ModulelistEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 编辑请求对象
 *
 * @author luocheng
 * @version 1.0
 * @date 2023/05/18 15:15
 */
@ApiModel
@Data
@NoArgsConstructor
@TableName("modulelist")
public class EditModuleVo implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "模块ID")
    @NotNull(message = "模块ID不能为空", groups = {UpdateGroup.class})
    @TableId(type = IdType.AUTO)
    private Long moduId;

    @ApiModelProperty(value = "模块标识",required = true)
    @NotNull(message = "模块标识不能为空")
    @Length(max = 15, message = "模块标识不能超过15个字符,请确认.")
    private String moduTag;

    @ApiModelProperty(value = "所属类别",required = true)
    @NotNull(message = "模块类别不能为空")
    private Long moduType;

    @ApiModelProperty(value = "模块名称",required = true)
    @NotNull(message = "模块名称不能为空")
    private String moduName;

    @ApiModelProperty(value = "模块地址",required = true)
    @NotNull(message = "模块地址不能为空")
    private String moduUrl;

    @ApiModelProperty(value = "排序",required = true)
    @NotNull(message = "排序不能为空")
    private Integer moduSort;

    @ApiModelProperty(value = "状态：0-启用;1-未启用",required = true)
    @NotNull(message = "状态不能为空")
    private Integer moduState;

    @ApiModelProperty(value = "模块图标")
    private String moduIcon;

    @ApiModelProperty(value = "备注")
    private String moduNote;

    @ApiModelProperty(value = "父级ID",required = true)
    private Long parentId;

    public ModulelistEntity vo2Entity(){
        ModulelistEntity entity = new ModulelistEntity();
        BeanUtils.copyProperties(this,entity);
        return entity;
    }

}
